<?php
!function_exists('adminmsg') && die('Forbidden');
require GetLang('dbset');
if($login_name!=$manager) Showmsg('onlycreator');
if($step==2)
{
	$creator_pwd !=$creator_pwd2 && Showmsg('set_confirmpwd');
	$S_key=array("\\",'&',' ',"'",'"','/','*',',','<','>',"\r","\t","\n",'#');
	foreach ($S_key as $value)
	{
		if (strpos($creator_pwd,$value)!==false){
			adminmsg('illegal_password');
		}
	}
	if($creator_pwd)
	{
		$creator_pwd = md5($creator_pwd);
		$setting['pwd']=$creator_pwd;
	}else{
		//$creator_pwd = $manager_pwd;
	}
	if($creator)
	{
		$setting['user']=$creator;
	}
	require_once(R_P.'require/class_cache.php');
	$cache = new Cache();
	$cache->sql($setting);
	if($db->get_one("SELECT * FROM cms_user WHERE username='$creator'"))
	{
		if ($creator_pwd) $sql = "password='$creator_pwd',";
		$db->update("UPDATE cms_user SET $sql ifadmin=1 WHERE username='$creator'");
	}
	else
	{
		Showmsg('请填写一个已经存在的用户');
		//$db->update("INSERT INTO cms_user SET password='$creator_pwd',username='$creator'");
	}
	adminmsg('operate_success');
}
require PrintEot('header');
require PrintEot('set_creator');
adminbottom();
?>